import 'package:dio/dio.dart';
import 'package:pet_app/model/article.dart';
import 'package:pet_app/model/breed.dart';
import 'package:pet_app/model/breed_group.dart';
import 'package:pet_app/model/breed_item.dart';
import 'package:pet_app/model/query/article_query.dart';
import 'package:pet_app/model/query/breed_search_query.dart';
import 'package:pet_app/net/page.dart';
import 'package:pet_app/net/page_query.dart';
import 'package:pet_app/net/result.dart';
import 'package:retrofit/http.dart';

part 'rest_client.g.dart';

@RestApi()
abstract class RestClient {
  factory RestClient(Dio dio, {String baseUrl}) = _RestClient;

  @POST('/breedGroup/queryPage')
  Future<Result<Page<BreedGroup>>> queryPageBreedGroup(
      @Body() PageQuery pageQuery);

  @POST('/breed/queryPage')
  Future<Result<Page<Breed>>> queryPageBreed(@Body() PageQuery pageQuery);

  @POST('/breed/list')
  Future<Result<Page<BreedItem>>> breedList(@Body() BreedSearchQuery query);

  @GET('/breed/listByBreedGroupId/{breedGroupId}')
  Future<Result<List<Breed>>> listByBreedGroupId(
      @Path('breedGroupId') int breedGroupId);

  @POST('/article/queryPage')
  Future<Result<Page<Article>>> queryPageArticle(@Body() ArticleQuery query);

  @GET('/article/getDetailByBreedId/{breedId}')
  Future<Result<Article>> getArticleByBreedId(
      @Path('breedId') int breedId);
}
